package com.minimalist.common.entity.basic.vo.file;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.springframework.web.multipart.MultipartFile;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * @author 11987
 */
@Schema(name = "文件上传实体")
public class FileUploadBatchVO implements Serializable{

    @Serial
    private static final long serialVersionUID = 1L;

    @NotEmpty(message = "上传的文件不能为空")
    @Schema(name = "files", description = "文件列表(支持多个文件)", type = "array")
    private List<MultipartFile> files;

    @NotNull(message = "文件来源不能为空")
    @Schema(name = "fileSource", description = "文件来源，字典：file-source-path", type = "int")
    private Integer fileSource;

    @Schema(name = "storageId", description = "存储ID，可为空。为空则取默认使用的存储", type = "int")
    private Long storageId;

    public List<MultipartFile> getFiles() {
        return files;
    }

    public void setFiles(List<MultipartFile> files) {
        this.files = files;
    }

    public Integer getFileSource() {
        return fileSource;
    }

    public void setFileSource(Integer fileSource) {
        this.fileSource = fileSource;
    }

    public Long getStorageId() {
        return storageId;
    }

    public void setStorageId(Long storageId) {
        this.storageId = storageId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FileUploadBatchVO that = (FileUploadBatchVO) o;
        return java.util.Objects.equals(files, that.files) &&
               java.util.Objects.equals(fileSource, that.fileSource) &&
               java.util.Objects.equals(storageId, that.storageId);
    }

    @Override
    public int hashCode() {
        return java.util.Objects.hash(files, fileSource, storageId);
    }

    @Override
    public String toString() {
        return "FileUploadBatchVO{" +
               "files=" + files +
               ", fileSource=" + fileSource +
               ", storageId=" + storageId +
               '}';
    }

}
